<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>chbmv.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="CHBMV.1"></a><a href="chbmv.f.html#CHBMV.1">CHBMV</a>(UPLO,N,K,ALPHA,A,LDA,X,INCX,BETA,Y,INCY)
<span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      COMPLEX ALPHA,BETA
      INTEGER INCX,INCY,K,LDA,N
      CHARACTER UPLO
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX A(LDA,*),X(*),Y(*)
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="CHBMV.14"></a><a href="chbmv.f.html#CHBMV.1">CHBMV</a>  performs the matrix-vector  operation
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     y := alpha*A*x + beta*y,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where alpha and beta are scalars, x and y are n element vectors and
</span><span class="comment">*</span><span class="comment">  A is an n by n hermitian band matrix, with k super-diagonals.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  ==========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  UPLO   - CHARACTER*1.
</span><span class="comment">*</span><span class="comment">           On entry, UPLO specifies whether the upper or lower
</span><span class="comment">*</span><span class="comment">           triangular part of the band matrix A is being supplied as
</span><span class="comment">*</span><span class="comment">           follows:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              UPLO = 'U' or 'u'   The upper triangular part of A is
</span><span class="comment">*</span><span class="comment">                                  being supplied.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">              UPLO = 'L' or 'l'   The lower triangular part of A is
</span><span class="comment">*</span><span class="comment">                                  being supplied.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N      - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, N specifies the order of the matrix A.
</span><span class="comment">*</span><span class="comment">           N must be at least zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  K      - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, K specifies the number of super-diagonals of the
</span><span class="comment">*</span><span class="comment">           matrix A. K must satisfy  0 .le. K.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  ALPHA  - COMPLEX         .
</span><span class="comment">*</span><span class="comment">           On entry, ALPHA specifies the scalar alpha.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  A      - COMPLEX          array of DIMENSION ( LDA, n ).
</span><span class="comment">*</span><span class="comment">           Before entry with UPLO = 'U' or 'u', the leading ( k + 1 )
</span><span class="comment">*</span><span class="comment">           by n part of the array A must contain the upper triangular
</span><span class="comment">*</span><span class="comment">           band part of the hermitian matrix, supplied column by
</span><span class="comment">*</span><span class="comment">           column, with the leading diagonal of the matrix in row
</span><span class="comment">*</span><span class="comment">           ( k + 1 ) of the array, the first super-diagonal starting at
</span><span class="comment">*</span><span class="comment">           position 2 in row k, and so on. The top left k by k triangle
</span><span class="comment">*</span><span class="comment">           of the array A is not referenced.
</span><span class="comment">*</span><span class="comment">           The following program segment will transfer the upper
</span><span class="comment">*</span><span class="comment">           triangular part of a hermitian band matrix from conventional
</span><span class="comment">*</span><span class="comment">           full matrix storage to band storage:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 DO 20, J = 1, N
</span><span class="comment">*</span><span class="comment">                    M = K + 1 - J
</span><span class="comment">*</span><span class="comment">                    DO 10, I = MAX( 1, J - K ), J
</span><span class="comment">*</span><span class="comment">                       A( M + I, J ) = matrix( I, J )
</span><span class="comment">*</span><span class="comment">              10    CONTINUE
</span><span class="comment">*</span><span class="comment">              20 CONTINUE
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Before entry with UPLO = 'L' or 'l', the leading ( k + 1 )
</span><span class="comment">*</span><span class="comment">           by n part of the array A must contain the lower triangular
</span><span class="comment">*</span><span class="comment">           band part of the hermitian matrix, supplied column by
</span><span class="comment">*</span><span class="comment">           column, with the leading diagonal of the matrix in row 1 of
</span><span class="comment">*</span><span class="comment">           the array, the first sub-diagonal starting at position 1 in
</span><span class="comment">*</span><span class="comment">           row 2, and so on. The bottom right k by k triangle of the
</span><span class="comment">*</span><span class="comment">           array A is not referenced.
</span><span class="comment">*</span><span class="comment">           The following program segment will transfer the lower
</span><span class="comment">*</span><span class="comment">           triangular part of a hermitian band matrix from conventional
</span><span class="comment">*</span><span class="comment">           full matrix storage to band storage:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">                 DO 20, J = 1, N
</span><span class="comment">*</span><span class="comment">                    M = 1 - J
</span><span class="comment">*</span><span class="comment">                    DO 10, I = J, MIN( N, J + K )
</span><span class="comment">*</span><span class="comment">                       A( M + I, J ) = matrix( I, J )
</span><span class="comment">*</span><span class="comment">              10    CONTINUE
</span><span class="comment">*</span><span class="comment">              20 CONTINUE
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">           Note that the imaginary parts of the diagonal elements need
</span><span class="comment">*</span><span class="comment">           not be set and are assumed to be zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDA    - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, LDA specifies the first dimension of A as declared
</span><span class="comment">*</span><span class="comment">           in the calling (sub) program. LDA must be at least
</span><span class="comment">*</span><span class="comment">           ( k + 1 ).
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  X      - COMPLEX          array of DIMENSION at least
</span><span class="comment">*</span><span class="comment">           ( 1 + ( n - 1 )*abs( INCX ) ).
</span><span class="comment">*</span><span class="comment">           Before entry, the incremented array X must contain the
</span><span class="comment">*</span><span class="comment">           vector x.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INCX   - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, INCX specifies the increment for the elements of
</span><span class="comment">*</span><span class="comment">           X. INCX must not be zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  BETA   - COMPLEX         .
</span><span class="comment">*</span><span class="comment">           On entry, BETA specifies the scalar beta.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Y      - COMPLEX          array of DIMENSION at least
</span><span class="comment">*</span><span class="comment">           ( 1 + ( n - 1 )*abs( INCY ) ).
</span><span class="comment">*</span><span class="comment">           Before entry, the incremented array Y must contain the
</span><span class="comment">*</span><span class="comment">           vector y. On exit, Y is overwritten by the updated vector y.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INCY   - INTEGER.
</span><span class="comment">*</span><span class="comment">           On entry, INCY specifies the increment for the elements of
</span><span class="comment">*</span><span class="comment">           Y. INCY must not be zero.
</span><span class="comment">*</span><span class="comment">           Unchanged on exit.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Level 2 Blas routine.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- Written on 22-October-1986.
</span><span class="comment">*</span><span class="comment">     Jack Dongarra, Argonne National Lab.
</span><span class="comment">*</span><span class="comment">     Jeremy Du Croz, Nag Central Office.
</span><span class="comment">*</span><span class="comment">     Sven Hammarling, Nag Central Office.
</span><span class="comment">*</span><span class="comment">     Richard Hanson, Sandia National Labs.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      COMPLEX ONE
      PARAMETER (ONE= (1.0E+0,0.0E+0))
      COMPLEX ZERO
      PARAMETER (ZERO= (0.0E+0,0.0E+0))
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      COMPLEX TEMP1,TEMP2
      INTEGER I,INFO,IX,IY,J,JX,JY,KPLUS1,KX,KY,L
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Functions ..
</span>      LOGICAL <a name="LSAME.144"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
      EXTERNAL <a name="LSAME.145"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL <a name="XERBLA.148"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC CONJG,MAX,MIN,REAL
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      IF (.NOT.<a name="LSAME.157"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(UPLO,<span class="string">'U'</span>) .AND. .NOT.<a name="LSAME.157"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(UPLO,<span class="string">'L'</span>)) THEN
          INFO = 1
      ELSE IF (N.LT.0) THEN
          INFO = 2
      ELSE IF (K.LT.0) THEN
          INFO = 3
      ELSE IF (LDA.LT. (K+1)) THEN
          INFO = 6
      ELSE IF (INCX.EQ.0) THEN
          INFO = 8
      ELSE IF (INCY.EQ.0) THEN
          INFO = 11
      END IF
      IF (INFO.NE.0) THEN
          CALL <a name="XERBLA.171"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>(<span class="string">'<a name="CHBMV.171"></a><a href="chbmv.f.html#CHBMV.1">CHBMV</a> '</span>,INFO)
          RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Quick return if possible.
</span><span class="comment">*</span><span class="comment">
</span>      IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Set up the start points in  X  and  Y.
</span><span class="comment">*</span><span class="comment">
</span>      IF (INCX.GT.0) THEN
          KX = 1
      ELSE
          KX = 1 - (N-1)*INCX
      END IF
      IF (INCY.GT.0) THEN
          KY = 1
      ELSE
          KY = 1 - (N-1)*INCY
      END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Start the operations. In this version the elements of the array A
</span><span class="comment">*</span><span class="comment">     are accessed sequentially with one pass through A.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     First form  y := beta*y.
</span><span class="comment">*</span><span class="comment">
</span>      IF (BETA.NE.ONE) THEN
          IF (INCY.EQ.1) THEN
              IF (BETA.EQ.ZERO) THEN
                  DO 10 I = 1,N
                      Y(I) = ZERO
   10             CONTINUE
              ELSE
                  DO 20 I = 1,N
                      Y(I) = BETA*Y(I)
   20             CONTINUE
              END IF
          ELSE
              IY = KY
              IF (BETA.EQ.ZERO) THEN
                  DO 30 I = 1,N
                      Y(IY) = ZERO
                      IY = IY + INCY
   30             CONTINUE
              ELSE
                  DO 40 I = 1,N
                      Y(IY) = BETA*Y(IY)
                      IY = IY + INCY
   40             CONTINUE
              END IF
          END IF
      END IF
      IF (ALPHA.EQ.ZERO) RETURN
      IF (<a name="LSAME.224"></a><a href="lsame.f.html#LSAME.1">LSAME</a>(UPLO,<span class="string">'U'</span>)) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Form  y  when upper triangle of A is stored.
</span><span class="comment">*</span><span class="comment">
</span>          KPLUS1 = K + 1
          IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
              DO 60 J = 1,N
                  TEMP1 = ALPHA*X(J)
                  TEMP2 = ZERO
                  L = KPLUS1 - J
                  DO 50 I = MAX(1,J-K),J - 1
                      Y(I) = Y(I) + TEMP1*A(L+I,J)
                      TEMP2 = TEMP2 + CONJG(A(L+I,J))*X(I)
   50             CONTINUE
                  Y(J) = Y(J) + TEMP1*REAL(A(KPLUS1,J)) + ALPHA*TEMP2
   60         CONTINUE
          ELSE
              JX = KX
              JY = KY
              DO 80 J = 1,N
                  TEMP1 = ALPHA*X(JX)
                  TEMP2 = ZERO
                  IX = KX
                  IY = KY
                  L = KPLUS1 - J
                  DO 70 I = MAX(1,J-K),J - 1
                      Y(IY) = Y(IY) + TEMP1*A(L+I,J)
                      TEMP2 = TEMP2 + CONJG(A(L+I,J))*X(IX)
                      IX = IX + INCX
                      IY = IY + INCY
   70             CONTINUE
                  Y(JY) = Y(JY) + TEMP1*REAL(A(KPLUS1,J)) + ALPHA*TEMP2
                  JX = JX + INCX
                  JY = JY + INCY
                  IF (J.GT.K) THEN
                      KX = KX + INCX
                      KY = KY + INCY
                  END IF
   80         CONTINUE
          END IF
      ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Form  y  when lower triangle of A is stored.
</span><span class="comment">*</span><span class="comment">
</span>          IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
              DO 100 J = 1,N
                  TEMP1 = ALPHA*X(J)
                  TEMP2 = ZERO
                  Y(J) = Y(J) + TEMP1*REAL(A(1,J))
                  L = 1 - J
                  DO 90 I = J + 1,MIN(N,J+K)
                      Y(I) = Y(I) + TEMP1*A(L+I,J)
                      TEMP2 = TEMP2 + CONJG(A(L+I,J))*X(I)
   90             CONTINUE
                  Y(J) = Y(J) + ALPHA*TEMP2
  100         CONTINUE
          ELSE
              JX = KX
              JY = KY
              DO 120 J = 1,N
                  TEMP1 = ALPHA*X(JX)
                  TEMP2 = ZERO
                  Y(JY) = Y(JY) + TEMP1*REAL(A(1,J))
                  L = 1 - J
                  IX = JX
                  IY = JY
                  DO 110 I = J + 1,MIN(N,J+K)
                      IX = IX + INCX
                      IY = IY + INCY
                      Y(IY) = Y(IY) + TEMP1*A(L+I,J)
                      TEMP2 = TEMP2 + CONJG(A(L+I,J))*X(IX)
  110             CONTINUE
                  Y(JY) = Y(JY) + ALPHA*TEMP2
                  JX = JX + INCX
                  JY = JY + INCY
  120         CONTINUE
          END IF
      END IF
<span class="comment">*</span><span class="comment">
</span>      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CHBMV.305"></a><a href="chbmv.f.html#CHBMV.1">CHBMV</a> .
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
